package com.ruoyi.quality.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quality.mapper.QualityCustomMapper;
import com.ruoyi.quality.domain.QualityCustom;
import com.ruoyi.quality.service.IQualityCustomService;

/**
 * 客户管理Service业务层处理
 *
 * @author wky
 * @date 2024-06-05
 */
@Service
public class QualityCustomServiceImpl implements IQualityCustomService
{
    @Autowired
    private QualityCustomMapper qualityCustomMapper;

    /**
     * 查询客户管理
     *
     * @param customId 客户管理主键
     * @return 客户管理
     */
    @Override
    public QualityCustom selectQualityCustomByCustomId(Long customId)
    {
        return qualityCustomMapper.selectQualityCustomByCustomId(customId);
    }

    /**
     * 查询客户管理列表
     *
     * @param qualityCustom 客户管理
     * @return 客户管理
     */
    @Override
    public List<QualityCustom> selectQualityCustomList(QualityCustom qualityCustom)
    {
        return qualityCustomMapper.selectQualityCustomList(qualityCustom);
    }

    /**
     * 新增客户管理
     *
     * @param qualityCustom 客户管理
     * @return 结果
     */
    @Override
    public int insertQualityCustom(QualityCustom qualityCustom)
    {
        qualityCustom.setCreateTime(DateUtils.getNowDate());
        return qualityCustomMapper.insertQualityCustom(qualityCustom);
    }

    /**
     * 修改客户管理
     *
     * @param qualityCustom 客户管理
     * @return 结果
     */
    @Override
    public int updateQualityCustom(QualityCustom qualityCustom)
    {
        return qualityCustomMapper.updateQualityCustom(qualityCustom);
    }

    /**
     * 批量删除客户管理
     *
     * @param customIds 需要删除的客户管理主键
     * @return 结果
     */
    @Override
    public int deleteQualityCustomByCustomIds(Long[] customIds)
    {
        return qualityCustomMapper.deleteQualityCustomByCustomIds(customIds);
    }

    /**
     * 删除客户管理信息
     *
     * @param customId 客户管理主键
     * @return 结果
     */
    @Override
    public int deleteQualityCustomByCustomId(Long customId)
    {
        return qualityCustomMapper.deleteQualityCustomByCustomId(customId);
    }

    @Override
    public List<Map<Long, Long>> getMonthCountMap(Long year) {
        return qualityCustomMapper.selectMonthCountMap(year);
    }

    @Override
    public List<Map<Long, Long>> getMonthCountBetween(Long startYear, Long endYear) {
        return qualityCustomMapper.selectMonthCountBetween(startYear,endYear);
    }
}
